package com.jilijili.controller;

import com.jilijili.grace.result.GraceJSONResult;
import com.jilijili.pojo.mo.MessageMo;
import com.jilijili.service.MsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @BelongsProject: jilijili-red-book-dev
 * @BelongsPackage: com.jilijili.controller
 * @Author: ljj
 * @CreateTime: 2022-04-09  22:02
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@Api(value = "MessageController 消息模块", tags = "消息模块理接口模块", produces = "ljj", consumes = "app")
@RestController
@RequestMapping("/api/msg")
public class MessageController {

    @Resource
    private MsgService msgService;

    @ApiOperation(value = "我的消息列表")
    @GetMapping(value = "/list")
    public GraceJSONResult list(@RequestParam(value = "userId", required = true) String userId,
                                @RequestParam(value = "page", defaultValue = "0") Integer page,
                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
        List<MessageMo> messageMos = msgService.queryList(userId, page, pageSize);
        return GraceJSONResult.ok(messageMos);
    }
}
